#include "DisplayInfo.h"
#include <QApplication>
#include <QDesktopWidget>

DisplayInfo::DisplayInfo()
{
	init();
}

void DisplayInfo::init()
{
	_size.clear();
	_geometry.setX(-1);
	_geometry.setY(-1);

	_displayCount = QApplication::desktop()->screenCount();
	_geometry = QApplication::desktop()->rect();

	for(int i=0;i<_displayCount;i++){
		_size.append(QApplication::desktop()->screenGeometry(i));
	}
}

int DisplayInfo::width()
{
	return _geometry.width();
}

int DisplayInfo::height()
{
	return _geometry.height();
}

int DisplayInfo::width(int screenNumber)
{
	if(screenNumber < 0 || screenNumber >= _size.count()) return -1;
	return _size.at(screenNumber).width();
}

int DisplayInfo::height(int screenNumber)
{
	if(screenNumber < 0 || screenNumber >= _size.count()) return -1;
	return _size.at(screenNumber).height();
}

int DisplayInfo::displayCount()
{
	return _displayCount;
}
